var log4js = require('log4js');
log4js.configure({
    appenders: {
        out: { type: 'console',layout: { type: 'colored' } },
        task: {
            type: 'dateFile',
            filename: 'logs/',
            pattern: 'yyyy-MM-dd.log',
            maxLogSize: 1024,
            backups: 4, // 日志备份数量，大于该数则自动删除
            alwaysIncludePattern: true
        }
    },
    categories: {
        default: { appenders: [ 'out' ], level: 'info' },
        task: { appenders: [ 'task' ], level: 'info' }
    }
});

exports.GetLogger = function (name) {
    var logger = log4js.getLogger(name);
    return logger;
};
